<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>朴与素连锁店管理信息系统</title>
<%@ include file="../../common/Style.jsp"%>
<link href="<%=request.getContextPath()%>/conf_files/css/pagination.css"
	rel="stylesheet" type="text/css" />
<SCRIPT src="<%=request.getContextPath()%>/conf_files/js/pagenav1.1.js"
	type=text/javascript></SCRIPT>
<script>
$(document).ready(function() {
	
	parent.$.messager.progress('close');
	
	
	var params = $.serializeObject($('#chainListForm'));

	dataGrid = $('#dataGrid').datagrid({
		url : 'chainMgmtJSON!listChainStores',
		queryParams: params,
		fit : true,
		border : false,
		pagination : true,
		pageSize : 20,
		pageList : [ 20, 30],		
		checkOnSelect : false,
		selectOnCheck : false,
		singleSelect:true,
		nowrap : false,
		rownumbers : true,
		columns : [ [ 
		              
		     {
				field : 'chain_name',
				title : '连锁店名称',
				width : 150,
				sortable:true,
				order:'desc'
			},{	
				field : 'owner_name',
				title : '连锁店经营者',
				width : 170			
			},{						
				field : 'brand',
				title : '品牌报表',
				width : 300,
				formatter : function(value, row, index) {
					var str = '';
					str += $.formatString('<a href="#" onclick="getLevelOne(\'{0}\');"><img border="0" src="{1}" title="品牌报表"/></a>', row.chain_id, '<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/text_1.png');
					return str;
				}
		    },{				
				field : 'category',
				title : '类别报表',
				width : 300,
				formatter : function(value, row, index) {
				var str = '';
				str += $.formatString('<a href="#" onclick="getLevelOneByCategoryId(\'{0}\');"><img border="0" src="{1}" title="类别报表"/></a>', row.chain_id, '<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/text_1.png');
				return str;
			}
		}]],
		toolbar : '#toolbar',
	});
	
	$("#chainId").combobox({
		onChange: function changeChainStore(value){
			findChainStore();
		}
	})
	
	
});

function findChainStore(){
	dataGrid.datagrid('load', $.serializeObject($('#chainListForm')));
}


	
/** 根据品牌查找 */
function getLevelOne(chainId) {
	$.messager.progress({
			title : '提示',
			text : '数据处理中，请稍后....'
		});
	window.location.href = "inventoryFlowJSPAction!getLevelOneCurrentInventory?formBean.rptTypeId=0&formBean.chainId=" + chainId;
}	
	
/** 根据货品类型查找 */
function getLevelOneByCategoryId(chainId){
	$.messager.progress({
			title : '提示',
			text : '数据处理中，请稍后....'
		});
	window.location.href = "inventoryFlowJSPAction!getLevelOneCurrentInventory?formBean.rptTypeId=1&formBean.chainId=" + chainId;
}
</script>
</head>
<body>

<div class="easyui-layout" data-options="fit : true,border : false">
		<div data-options="region:'north',border:false"
			style="height: 35px; overflow: hidden;">
			
			
			<form id="chainListForm" name="chainListForm" method="post">
					
				<strong>连锁店:</strong>
				<s:select size="1" cssClass="easyui-combobox" style="width:165px" id="chainId" list="uiBean.chainStores" listKey="chain_id" name="formBean.chainId" listValue="chain_name" />
				
			</form>
		</div>
		<div data-options="region:'center',border:false">
			<table id="dataGrid">
			</table>

			<div id="toolbar" style="display: none;">
				<a onclick="findChainStore();" href="javascript:void(0);"
					class="easyui-linkbutton"
					data-options="iconCls:'icon-search',plain:true">搜索店铺</a>  
			</div>
		</div>
	</div>
</body>

</html>